import process from 'process'

export class IParams {
    pipelineID!: number

    pipelineName!: string

    buildNumber?: number

    workSpace!: string

    projectDir!: string

    buildJobID!: number

    REGION_ID!: string

    ROS_DEPLOYMENT_LOCATION!:string

    RAM_ROLE_NAME!:string

    STACK_NAME!:string

    ROS_STACK_FILE_PATH!:string

    TIMEOUT_MINUTES!:number
}

export function getParams(): IParams {
    let params = new IParams()
    params.pipelineID = Number(process.env.PIPELINE_ID)
    params.pipelineName = process.env.PIPELINE_NAME as string
    params.buildNumber = Number(process.env.BUILD_NUMBER)
    params.workSpace = process.env.WORK_SPACE as string
    params.projectDir = process.env.PROJECT_DIR as string
    params.buildJobID = Number(process.env.BUILD_JOB_ID)
    params.REGION_ID = process.env.REGION_ID as string
    params.ROS_DEPLOYMENT_LOCATION = process.env.ROS_DEPLOYMENT_LOCATION  as string
    params.RAM_ROLE_NAME = process.env.RAM_ROLE_NAME as string
    params.STACK_NAME = process.env.STACK_NAME as string
    params.ROS_STACK_FILE_PATH = process.env.ROS_STACK_FILE_PATH as string
    params.TIMEOUT_MINUTES = Number(process.env.TIMEOUT_MINUTES)
    return params
}